package com.framework.modules.terminal;

import com.framework.exception.util.RespResult;
import com.framework.modules.sys.controller.AbstractController;
import com.framework.modules.terminal.service.SysTerminalTypeService;
import com.framework.page.PageUtils;
import com.framework.service.yhbservice.YhbTerminalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author wq
 */
@RequestMapping("sys/terminal")
@RestController
public class TerminalController extends AbstractController {

    @Autowired
    private SysTerminalTypeService sysTerminalTypeService;

    @Autowired
    private YhbTerminalService yhbTerminalService;
    /**
     * 类型列表
     * @return
     */
    @RequestMapping("sysTerTypeList")
    public RespResult terminaltypeList(){
        List<Map<String,Object>> list=sysTerminalTypeService.queryterminaltypeList(getDeptUserId());
        return RespResult.ok().put("list", list);
    }


    /**
     * 终端列表
     * @return
     */
    @RequestMapping("list")
    public RespResult list(@RequestParam Map<String,Object> params){
        params.put("sysUserId",getDeptUserId());
        PageUtils page=yhbTerminalService.queryTerminalPage(params);
        return RespResult.ok().put("page", page);
    }


    @RequestMapping("distribuTer")
    public RespResult distribuTer(@RequestBody Map<String,Object> q){
        yhbTerminalService.distribuTer(q);
        return RespResult.ok();
    }
}
